Remove implicit to_hash conversion from Config #114
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This causes problems when passing config objects to methods with
**splat
-style "kwrest" keyword parameters, since it will result in the config object unintentionally being destructured into a hash.I don't believe this
to_hash
behaviour is a critical aspect of what we're offering with dry-configurable. My feeling is that no one really expects a config object to be 100% substitutable with a hash, and getting a plain hash when required is still easy via#to_h
or#values
.I've raised this PR because of failures in hanami/hanami#1107 for the tests running against Ruby 2.6: we pass one config object to another configurable object, and it ends up being deconstructed into a Hash, which is not expected and causes failures when we then try to reference settings by their named methods.